package com.dong.design.adapter;

/**
 * 适配器
 *
 * @author jianyang206881
 * @date 2018/6/8
 */
public class MediaAdapter implements MediaPlayer {

    private AdvanceMediaPlayer advanceMediaPlayer;

    public MediaAdapter(String audioType) {
        switch (audioType) {
            case "vlc":
                advanceMediaPlayer = new VlcPlayer();
                return;
            case "mp4":
                advanceMediaPlayer = new Mp4Player();
                return;
            default:
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        switch (audioType) {
            case "vlc":
                advanceMediaPlayer.playVlc(fileName);
                return;
            case "mp4":
                advanceMediaPlayer.playMp4(fileName);
                return;
            default:
        }
    }
}
